package cn.tedu.kcircle.content.admin.adapter.rpc;

import cn.tedu.dto.ContentUpdateCheckStateDTO;
import cn.tedu.kcircle.content.admin.adapter.converter.ContentConverter;
import cn.tedu.kcircle.content.admin.api.rpc.ContentAdminRpcApi;
import cn.tedu.kcircle.content.admin.repository.model.ContentUpdateCheckStateModel;
import cn.tedu.kcircle.content.admin.repository.persist.ContentAdminRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class ContentAdminRpcApiImpl implements ContentAdminRpcApi {
    private ContentAdminRepository contentAdminRepository;
    private ContentConverter converter;


    @Override
    public int updateCheckStateById(ContentUpdateCheckStateDTO contentUpdateCheckStateDTO) {
        ContentUpdateCheckStateModel contentUpdateCheckStateModel = converter.dto2Model(contentUpdateCheckStateDTO);
        return contentAdminRepository.updateCheckStatusById(contentUpdateCheckStateModel);
    }

    @Override
    public int queryCheckStateById(Long id) {
        return contentAdminRepository.getCheckStateById(id);
    }
}
